You are here: Language Elements and Expressions > Operator Precedence
As in conventional mathematics, ProModel evaluates expressions with more than one operator according to certain rules of precedence. Expressions with more than one operator are evaluated in the following order:
1. Terms inside parentheses: ( )
3. Multiplication: *; Division: /; and Modulus: @
4. Addition: +; Subtraction: -
5. Equalities and Inequalities: =, <>, >, >=, <, <=
9. Concatenation: $; (For string expressions only.)
When evaluating more than one operator with the same precedence, ProModel works from left to right.
Arithmetic and boolean expressions may include nested expressions (expressions in parentheses) to indicate precedence in complex expressions such as the following examples:
Nested expressions
A+B*(C+D)
((A>B) OR (B>C)) AND (C>D)
The expression (C+D) is a nested expression which is evaluated first. Multiple nesting is permitted, with the innermost nesting being evaluated first.
15 - MATRIX[4]**2 + CLOCK(MIN) / 60
In this expression, Matrix[4]**2 is evaluated first, with the result being subtracted from 15. This value is then added to the value obtained from Clock(min)/60.
Example 2
(A>B) OR (A>C) AND (A=D)
would evaluate
(A>B) OR ((A>C) AND (A=D))